<template>
  <div class="show-base">
    <div class="bg">
      <div class="host-body">
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10"/>
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColor"/>
            <div class="title">
              <span class="title-text">{{ detail.title }}</span>
              <dv-decoration-6
                class="dv-dec-6"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
              />
            </div>
            <dv-decoration-8
              class="dv-dec-8"
              :reverse="true"
              :color="decorationColor"
            />
          </div>
          <dv-decoration-10 class="dv-dec-10-s"/>
        </div>
        <div class="body-box">
          <div class="body-box-left">
            <div style="height: 50%; width: 100%;" v-if="isRouterAlive">
              <dv-border-box-8>
                <left-up-box
                  v-if="detail"
                  :browseNumber="detail.browseNumber"
                  :personBrowseNumber="detail.personBrowseNumber"
                  :orderNumber="detail.orderNumber"
                  :shareNumber="detail.shareNumber"
                  :is-show-student="detail.isShowStudent"
                  :old-student="detail.oldStudent"
                  :new-student="detail.newStudent"
                ></left-up-box>
              </dv-border-box-8>
            </div>
            <div style="height: 45%; width: 100%;">
              <dv-border-box-13>
                <left-below-box
                  v-if="detail"
                  :sixHours="detail.sixHours"
                  :sixHoursBrowseNumber="detail.sixHoursBrowseNumber"
                  :sixHoursPersonBrowseNumber="detail.sixHoursPersonBrowseNumber"
                ></left-below-box>
              </dv-border-box-13>
            </div>
          </div>
          <div class="body-box-center" v-if="isRouterAlive">
            <div style="height: 75%; width: 100%;">
              <dv-border-box-10>
                <center-up-box
                  v-if="detail"
                  :enrollNumber="detail.enrollNumber"
                  :times="{start: detail.startTime,end: detail.endTime}"
                  :dataList="detail.enrollList"
                ></center-up-box>
              </dv-border-box-10>
            </div>
            <div style="height: 20%; width: 100%;">
              <dv-border-box-1>
                <center-below-box
                  v-if="detail"
                  :staffRank="detail.staffRank"
                ></center-below-box>
              </dv-border-box-1>
            </div>
          </div>
          <div class="body-box-right" v-if="isRouterAlive">
            <div style="height: 50%; width: 100%;">
              <dv-border-box-8>
                <right-up-box
                  v-if="detail"
                  :staffRankList="detail.staffRankList"
                ></right-up-box>
              </dv-border-box-8>
            </div>
            <div style="height: 45%; width: 100%;">
              <dv-border-box-13>
                <right-below-box
                  v-if="detail"
                  :staffRankTeamList="detail.staffRankTeamList"
                ></right-below-box>
              </dv-border-box-13>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CenterBelowBox from './triones/activity/components/bigdataPriview/CenterBelowBox'
import CenterUpBox from './triones/activity/components/bigdataPriview/CenterUpBox'
import LeftBelowBox from './triones/activity/components/bigdataPriview/LeftBelowBox'
import LeftUpBox from './triones/activity/components/bigdataPriview/LeftUpBox'
import RightBelowBox from './triones/activity/components/bigdataPriview/RightBelowBox'
import RightUpBox from './triones/activity/components/bigdataPriview/RightUpBox'
import { activityBigData } from "@/api/triones/activity";
export default {
  name: "dataPing",
  components: {
    CenterBelowBox,
    CenterUpBox,
    LeftBelowBox,
    LeftUpBox,
    RightBelowBox,
    RightUpBox
  },
  provide () {
    return {
      reload: this.reload
    }
  },
  watch: {
    detail: {
      handler(newVal,oldVal) {
        this.reload();
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      decorationColor: ['#568aea', '#000000'],
      detail: '',
      timer: null, //定时器名称
      isRouterAlive: true
    }
  },
  created() {
    this.getActivityBigData(this.$route.query.activityId);
    this.timer = setInterval(() => {
      setTimeout(() => {
        this.getActivityBigData(this.$route.query.activityId);
      }, 0)
    }, 3000)
  },
  methods: {
    /** 获取活动大屏数据 */
    getActivityBigData(id) {
      activityBigData(id).then(response => {
        this.detail = response.data;
      })
    },
    reload () {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    }
  },
  beforeDestroy(){
    clearInterval(this.timer);
    this.timer = null;
  }
}
</script>

<style lang="scss" scoped>

.show-base {
  color: #d3d6dd;
  width: 90%;
  height: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: left top;
  .bg {
    width: 100%;
    height: auto;
    background-image: url("../assets/images/bigdata/pageBg.png");
    background-size: contain;
    background-position: center center;
  }
  .host-body {
    padding: 10px;
    width: 100%;
    height: 100%;
    .dv-dec-10,
    .dv-dec-10-s {
      width: 33.3%;
      height: 10px;
    }
    .dv-dec-10-s {
      transform: rotateY(180deg);
    }
    .dv-dec-8 {
      width: 200px;
      height: 50px;
    }
    .title {
      position: relative;
      width: 500px;
      text-align: center;
      background-size: cover;
      background-repeat: no-repeat;

      .title-text {
        font-size: 24px;
        position: absolute;
        bottom: 0;
        top: 10px;
        left: 50%;
        width: 100%;
        transform: translate(-50%);
      }

      .dv-dec-6 {
        position: absolute;
        bottom: -30px;
        left: 50%;
        width: 250px;
        height: 8px;
        transform: translate(-50%);
      }
    }

    // 第二行
    .aside-width {
      width: 40%;
    }
    .react-r-s,.react-l-s {
      background-color: #0f1325;
    }

    // 平行四边形
    .react-right {
      &.react-l-s {
        text-align: right;
        width: 500px;
      }
      font-size: 18px;
      width: 300px;
      line-height: 50px;
      text-align: center;
      transform: skewX(-45deg);

      .react-after {
        position: absolute;
        right: -25px;
        top: 0;
        height: 50px;
        width: 50px;
        background-color: #0f1325;
        transform: skewX(45deg);
      }

      .text {
        display: inline-block;
        transform: skewX(45deg);
      }
    }

    .react-left {
      &.react-l-s {
        width: 500px;
        text-align: left;
      }
      font-size: 18px;
      width: 300px;
      height: 50px;
      line-height: 50px;
      text-align: center;
      transform: skewX(45deg);
      background-color: #0f1325;

      .react-left {
        position: absolute;
        left: -25px;
        top: 0;
        height: 50px;
        width: 50px;
        background-color: #0f1325;
        transform: skewX(-45deg);
      }

      .text {
        display: inline-block;
        transform: skewX(-45deg);
      }
    }

    .body-box {
      height: calc(1080px - 200px);
      margin-top: 16px;
      display: flex;
      .body-box-left {
        width: 30%;
      }
      .body-box-center {
        width: 40%;
      }
      .body-box-right {
        width: 30%;
      }
    }
  }
}

.d-flex {
  display: flex;
  align-content: center;
  justify-content: center;
}

</style>
